Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brenda Rios - Solar System - Octos #31

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

brendarios
Copy link

@brendarios brendarios commented Feb 12, 2018

Solar System

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
What was the purpose of the initialize method in your class? To set the instance variables that will be used within the class, so to be able to call the class .new method.
Describe an instance variable you used and what you used it for. @name is an instance variable I have in my program. This instance variable is used inside my Planet class
Describe what the difference would be if your SolarSystem used an Array vs a Hash. My program is using an array of planets, so if I would have used a hash, the keys could be the Planet's names and the values the corresponding Planet object. The hash would facilitate looking for a planet by its name rather than using the index.
Do you feel like you used consistent formatting throughout your code? Yes

@droberts-sea
Copy link

Solar System

What We're Looking For

Feature Feedback
Baseline
Readable code with consistent indentation. yes
Primary Requirements
Created Custom Solar System Class with initialize, add planet & list planets methods, without using puts. yes
Planet Class Created yes
Created a collection of Planet objects as an instance variable in SolarSystem. yes
Accessor methods created yes
Method created to return the Planet's attributes and not use puts yes
Created a user interface to interact with the SolarSystem including adding a planet and viewing a planet's details yes
Additional Notes Great job overall! I have a couple of inline comments below that you should check out, but in general I am quite happy with this submission. Keep up the hard work!

# Method for the user to create a new planet
def new_planet(solar)

# The loop will enable the user to continue adding new planets until wanted.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that you've broken this and read_about_planet out as separate methods. Good organization!

interface(system_)

# Planets list will be updated
again(system_)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an interesting interaction here, where interface calls again, which in turn calls interface. The repeated calls end up making a loop. This is an example of a programming technique called recursion, which you'll learn about in CS Fun in a few months.

Recursion is a powerful tool that can elegantly solve many problems. However, in this case I think a while loop might be a better choice, if only because it makes it immediately obvious to the reader that this code might execute many times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants